package com.itheima.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KafkaController {
    @Autowired
    KafkaTemplate<String,String> kafkaTemplate;

    @GetMapping("/{topic}/{msg}")
    public String send(@PathVariable String topic, @PathVariable String msg){
        kafkaTemplate.send(topic,msg);
        return "发送成功";
    }

}
